package com.example.index.controller;

import com.example.index.entity.Book;
import com.example.index.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 毕业证书(Book)表控制层
 *
 * @author makejava
 * @since 2023-08-29 15:10:37
 */
@Controller
public class BookController {

    @Autowired
    BookService bookService;

    @GetMapping("book")
    public String book(ModelMap modelMap, HttpSession session) {

        Page<Book> books = bookService.queryByPage(new Book(), PageRequest.of(0, 1000));
        List<Book> bookList = books.getContent();
        System.out.println(bookList);
        modelMap.addAttribute("bookList", bookList);
        return "book";
    }
}

